<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            //$table->id();
            //$table->string('name');
            //$table->string('email')->unique();
            //$table->timestamp('email_verified_at')->nullable();
            //$table->string('password');
            //$table->rememberToken();
            //$table->timestamps();

            $table->bigIncrements('id');
            $table->unsignedTinyInteger('user_type')->default(0)->comment('用户类型;1:admin;0:会员');
            $table->string('username',50)->comment('账号');
            $table->string('name',50)->default('未知')->comment('真实姓名');
            $table->string('password',255)->comment('密码');
            $table->integer('birthday')->default(0)->comment('生日');
            // nullable 可以为null
            $table->string('avatar',250)->comment('头像');
            $table->string('email',50)->unique()->nullable()->comment('邮箱');
            $table->timestamp('email_verified_at')->nullable();
            $table->string('phone',50)->default('')->comment('手机号码');
            $table->enum('gender',['0','1','2'])->default('0')->comment('性别 0：未知、1：男、2：女');
            $table->unsignedTinyInteger('age')->default(0)->comment('年龄');
            $table->string('card',18)->default('')->comment('身份证号');
            $table->string('card_img',255)->default('')->comment('身份证照片');
            $table->enum('is_auth',['0','1'])->default('0')->comment('认证未认证0否，1是');
            $table->char('last_ip',15)->default('')->comment('登录IP');
            $table->integer('country')->default(0)->comment('国家');
            $table->integer('province')->default(0)->comment('省');
            $table->integer('city')->default(0)->comment('市');
            $table->integer('district')->default(0)->comment('区县');
            $table->rememberToken()->comment('记住我')->nullable();
            $table->uuid('uuid');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
